<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<c-rt:if test="${!empty param.typeId}">
<c-rt:set var="tp" value="${pu:pageableTag('tpp', 10, 10)}"/>
<c-rt:set var="params" value="${pu:addToList('paras', param.typeId)}"/>
<c-rt:set var="terminateCodeTypes" value="${pu:queryByHql('from TerminateCodeType where parent.id=?', params, null)}"/>
<c-rt:set var="terminateCodes" value="${pu:queryByHql('from TerminateCode where type.id=?', params, tp)}"/>
</c-rt:if>
<c-rt:if test="${empty param.typeId}">
<c-rt:set var="terminateCodeTypes" value="${pu:queryByHql('from TerminateCodeType where parent is null', params, null)}"/>
</c-rt:if>
<table class="tb-data"><tr><th>类型</th><td>
<c-rt:forEach items="${terminateCodeTypes}" var="type">
<a href="javascript:;" onclick="doAR('<%=application.getContextPath() %>/workOrder/page.do?iamlazy=terminateCode&AJAX=true&refreshZone=terminateCodeZone&typeId=${type.id}&id=${param.id }', 'terminateCodeZone')">${type.name }</a>
</c-rt:forEach>
</td>
</tr>
<tr>
<th>结束码</th>
<td>
<table class="tb-data">
<c-rt:forEach items="${terminateCodes}" var="code">
<tr><td>
${code.name }
</td>
<td>
<a href="javascript:;" onclick="doAR('<%=application.getContextPath() %>/workOrder/closeOrder.do', 'main', 'theForm')">选择并结束工单</a>
</td>
</tr>
</c-rt:forEach>
</table>
<c-rt:set var="url">
<%=application.getContextPath() %>/workOrder/page.do
</c-rt:set>
<pageable:Pageable key="tpp" escapeparams="iamlazy,AJAX,refreshZone" parameter="iamlazy=terminateCode&AJAX=true&refreshZone=terminateCodeZone" url="${url}" formname="terminateForm"></pageable:Pageable>
</td></tr></table>